public class Demo
{
    private int id;//字段field
    private String name;
    private int age;

    public Demo()
    {
        
    }

    public Demo(int id, string name, int age)
    {
        this.id = id;
        this.name = name;
        this.age = age;
    }
    //属性 property
    public int Id
    {
        get => id;
        /*get
        {
            return id;
        }*/
        set => id = value;
        /*set
        {
            id = value;
        }*/
    }

    public String Name
    {
        get => name;
        set => name = value ?? throw new ArgumentNullException();
    }

    public int Age
    {
        get => age;
        set => age = value;
    }

    public void TestPrint()
    {
        Father father = new Father();
        father.Print();
        
        Child child = new Child();
        child.Print();
        Console.WriteLine("----------------------");
        Father f1 = new Child();//编译看左，执行看右
        f1.Print();
        Father f2 = new Son();
        f2.Print();

        //int result = Add(10,20); 
        //Add(1.0f,2.0f);
        //Console.WriteLine(result);
    }

    public int Add(int a, int b)
    {
        return a + b;
    }
    
    public double Add(double a, int b)
    {
        return a + b;
    }
    
    public double Add(int a, double b)
    {
        return a + b;
    }
    public static float Add(float a, float b)
    {
        //静态方法中无法调用非静态方法
        return a + b;
    }
}